GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Branch master (b17032)
by Keith
68:36
created

install01-getting-started.js ➔ mySuccess   C

Complexity

Conditions 11

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 11
eloc 6
dl 0
loc 9
rs 5.4
c 0
b 0
f 0

How to fix   Complexity   

Complexity

Complex classes like install01-getting-started.js ➔ mySuccess often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

1
"use strict";
2
3
app.controller('install01Controller', ['$scope', '$q', '$http', '$interval', '$rootScope', function ($scope, $q, $http, $interval, $rootScope) {
4
	$("#download_button").hide();
5
	
6
	$scope.mergeContent = function(){
7
		if($scope.releaseInfoStack.length > 0){
8
			var latestRelease = $scope.releaseInfoStack[0];
9
			console.dir(latestRelease)
10
			var tag_name = latestRelease.tag_name;
11
			var releaseZipDownloadURL = latestRelease.zipball_url;
12
			var releaseTarDownloadURL = latestRelease.tarball_url;
13
			
14
			$("#latest_release_zip").text(tag_name).parent("a").attr("href", releaseZipDownloadURL);
15
			$("#latest_release_tar").text(tag_name).parent("a").attr("href", releaseTarDownloadURL);
16
			
17
			$("#loading_info").hide();
18
			$("#download_button").show();
19
		}
20
	}
21
	
22
	$scope.get_information = function(){
23
		$scope.initial_variable();
24
		
25
		var getReleaseInfoResule = $scope.get_github_release_info();
26
		getReleaseInfoResule.then(function(infoObjList) {
27
			$scope.releaseInfoStack = infoObjList;
28
		}, function(reason) {
29
		});
30
		
31
		$q.all([getReleaseInfoResule]).then(function() {
32
			$scope.mergeContent();
33
		});
34
	}
35
	$scope.get_github_release_info = function(){
36
		var arrayList = [];
37
        
38
		var promise = $q(function(resolve, reject) {
39
			var array = {text:"commits", amt:"10101", options};
0 ignored issues
show
Unused Code introduced by
The variable array seems to be never used. Consider removing it.
Loading history...
40
			
41
			$http({
42
				method : "GET",
43
				url : "https://api.github.com/repos/Otaku-Projects/AngularJS-CRUD-PHP/releases"
44
			}).then(function mySuccess(response) {
45
				var returnData = response.data;
46
				var totalReleasesCount = 0;
0 ignored issues
show
Unused Code introduced by
The variable totalReleasesCount seems to be never used. Consider removing it.
Loading history...
47
				returnData.forEach(function(releasesObj){
48
					arrayList.push(releasesObj);
49
				});
50
				
51
				resolve(arrayList);
52
			}, function myError(response) {
53
				reject(new Error('get project release info error'));
54
			});
55
			
56
		});
57
		
58
		return promise;
59
	}
60
    $scope.initial_variable = function(){
61
        $scope.releaseInfoStack = [];
62
    }
63
	function start_milestones(stackObjectList){
0 ignored issues
show
introduced by
The function start_milestones does not seem to be used and can be removed.
Loading history...
64
        $("#milestones").html("");
65
        
66
        var infoObj = stackObjectList.shift();
67
        var elementContent = infoObj.text;
68
        var countUpAmt = infoObj.amt;
69
        var options = infoObj.options;
70
        $("#milestones").html("<div class='animated'>"+elementContent+"</div>");
71
        $("#milestones div").addClass("fadeInUp");
72
        
73
		if(!$scope.countUp){
74
			$scope.countUp = new CountUp("count_up_amt", 0, options);
75
			$scope.countUp.start();
76
			$("#count_up_amt").hide();
77
		}
78
		$("#count_up_amt").show();
79
		$scope.countUp.update(countUpAmt);
80
		
81
        stackObjectList.push(infoObj);
82
	}
83
	
84
	$scope.get_information();
85
}]);